//TempControl Tests

import org.junit.*;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.*;

public class TempControlTests {
  /*Main method runs tests in this file*/ 
  public static void main(String args[]) {
    org.junit.runner.JUnitCore.main("TempControlTests");
  } 
  
  
  //***TESTING THE CUNSTRUCTOR****
  @Test
  public void constructorTest()
  {
    TempControl tc=new TempControl(10,20);
    assertTrue(tc.desiredTemp==20);
    assertTrue(tc.currentIndoorTemp==10);
  }
  
  //***TESTING THE COMPONENTS: fan, AC, heat
  @Test
  public void fanOnTest()
  {
    TempControl tc=new TempControl(10,20);
    boolean fanOn=tc.activateFan();
    assertTrue(fanOn==true);
  }
  
  @Test
  public void fanOffTest()
  {
    TempControl tc=new TempControl(10,20);
    boolean fanOn=tc.deactivateFan();
    assertTrue(fanOn==false);
  }
  
  @Test
  public void acOnTest()
  {
    TempControl tc=new TempControl(10,20);
    boolean acOn=tc.activateAC();
    assertTrue(acOn==true);
  }
  
  @Test
  public void acOffTest()
  {
    TempControl tc=new TempControl(10,20);
    boolean acOn=tc.deactivateAC();
    assertTrue(acOn==false);
  }
  
  @Test
  public void heatOnTest()
  {
    TempControl tc=new TempControl(10,20);
    boolean heatOn=tc.activatePrimaryHeat();
    assertTrue(heatOn==true);
  }
  
  @Test
  public void heatOffTest()
  {
    TempControl tc=new TempControl(10,20);
    boolean heatOn=tc.deactivatePrimaryHeat();
    assertTrue(heatOn==false);
  }
  
  //Add tests for setting modes
  
  @Test
  public void setModeFanOy()
  {
    TempControl tc=new TempControl(10,20);
    tc.setMode("fanOnly");
    assertTrue(tc.currentMode.equals("fanOnly"));
  }
  
  @Test
  public void setModeOff()
  {
    TempControl tc=new TempControl(10,20);
    tc.setMode("Off");
    assertTrue(tc.currentMode.equals("Off"));
  }
  
  @Test
  public void setModeAC()
  {
    TempControl tc=new TempControl(10,20);
    tc.setMode("AC");
    assertTrue(tc.currentMode.equals("AC"));
  }
  
  @Test
  public void setModeHeat()
  {
    TempControl tc=new TempControl(10,20);
    tc.setMode("Heat");
    assertTrue(tc.currentMode.equals("Heat"));
  }
  

  @Test
  public void monitorTempAC()
  {
    TempControl tc=new TempControl(10,2);
    tc.regulateCooling(2);
    
    assertTrue(tc.monitorTemp());
  }
  
   @Test
  public void monitorTempACWarmerDesired()
  {
    TempControl tc=new TempControl(10,2);
    boolean fail=tc.regulateCooling(12);
    
    assertFalse(fail);
  }
  
  @Test
  public void monitorTempHeat()
  {
    TempControl tc=new TempControl(10,20);
   tc.regulateHeating(20);
    
    assertTrue(tc.monitorTemp());
  }
  
  @Test
  public void monitorTempHeatColderDesired()
  {
    TempControl tc=new TempControl(10,20);
   boolean fail=tc.regulateHeating(2);
    
    assertFalse(fail);
  }
  
  //Add tests for getCurrentMode
  @Test
  public void getCurrentMode()
  {
    TempControl tc=new TempControl(10,20);
    tc.setMode("Heat");
    String mode = tc.getCurrentMode();
    
    assertTrue(mode.equals("Heat"));
  }
  
  
}